#ifndef GRAPHSTRUCTURES_H
#define GRAPHSTRUCTURES_H

#include <opencv/cv.h>

struct Node {
	explicit Node() : valid(false), visited(false) {
		neighbors.reserve(4);
	}
	
	explicit Node(cv::Point location) :
		location(location),
		valid(true),
		visited(false)
	{
		neighbors.reserve(4);
	}
	
	cv::Point location;
	std::vector<Node *> neighbors;
	bool valid;
	bool visited;
};

struct Path {
	explicit Path(Node *node, int cost, int expected) :
		cost(cost),
		expected(expected)
	{
		nodes.push_back(node);
	}
	
	explicit Path(const Path &path, Node *node, int additional, int expected) :
		cost(path.cost + additional),
		expected(expected)
	{
		nodes.insert(nodes.begin(), path.nodes.begin(), path.nodes.end());
		nodes.push_back(node);
	}
	
	bool operator<(const Path &path) const {
		return cost + expected > path.cost + path.expected;
	}
	
	std::vector<Node *> nodes;
	
	/**
	 * The actual cost to travel along this path from the start node.
	 */
	int cost;
	
	/**
	 * The expected cost (heuristic) to travel from the end of this path to
	 * the goal.
	 */
	int expected;
};

#endif